package br.com.mmm.javacenter.framework.filters.wrapper;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletOutputStream;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;

public class HttpServletResponseWrapper extends javax.servlet.http.HttpServletResponseWrapper{
	private BufferOutputStream baos = new BufferOutputStream();
	
	public HttpServletResponseWrapper(ServletResponse response) {
		super((HttpServletResponse) response);
	}

	public BufferOutputStream getBaos() {
		return baos;
	}

	public void setBaos(BufferOutputStream baos) {
		this.baos = baos;
	}
	@Override
	public ServletOutputStream getOutputStream() throws IOException {
		return baos;
	}

	PrintWriter writer = new PrintWriter(baos);
	
	@Override
	public PrintWriter getWriter() throws IOException {
		return writer;
	}
	@Override
	public void setBufferSize(int size) {
		System.out.println("BufferSize : " + size);
		//super.setBufferSize(size);
	}
	@Override
	public int getBufferSize() {
		System.out.println("buffer size");
		return super.getBufferSize();
	}
	@Override
	public void flushBuffer() throws IOException {
		System.out.println("opa");
		getBaos().flush();
	}
	
	
	
}
